#ifndef _LIB_AJAX
#define _LIB_AJAX

var Ajax = function(url, fn, method) {
	method = (method || 'GET').toUpperCase(),
	url = url.replace('?_fb_q=1', '');
	if (method == 'POST') {
		url = url.match(new RegExp('^(.*?)\\?(.*)$'));
		return GM_xmlhttpRequest({
			method: 'POST',
			url: url[1],
			data: url[2],
			headers: {
				'Content-type': 'application/x-www-form-urlencoded'
			},
			onload: fn
		});
	}
	return GM_xmlhttpRequest({
		method: 'GET',
		url: url,
		onload: fn
	});
};
#endif
